﻿Imports System.Configuration

''' <summary>
''' 環境リスト
''' </summary>
''' <remarks></remarks>
Public Class EnvironmentElementCollection
    Inherits ConfigurationElementCollection

    Public Sub New()
        MyBase.AddElementName = "environment"
    End Sub

    ''' <summary>
    ''' 要素を取得します
    ''' </summary>
    Public Function GetElement(ByVal name As String) As EnvironmentElement
        Return DirectCast(MyBase.BaseGet(name), EnvironmentElement)
    End Function

    ''' <summary>
    ''' 新しい要素を作成します
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Protected Overloads Overrides Function CreateNewElement() As System.Configuration.ConfigurationElement
        Return New EnvironmentElement
    End Function

    Protected Overrides Function GetElementKey(ByVal element As System.Configuration.ConfigurationElement) As Object
        Dim el As EnvironmentElement = TryCast(element, EnvironmentElement)
        If el Is Nothing Then Return Nothing
        Return el.Name
    End Function

End Class
